/*----------------------------------------------------------------------------------------
*
*  Copyright 2019, Gao Hai Hui, <fromzeropoint@126.com>.  All rights reserved.
*  https://gitee.com/helloworldghh/xoskit.git
*  Use of this source code is governed by a MIT license
*  that can be found in the License file.
*
----------------------------------------------------------------------------------------*/
#ifndef __SERVLET_SERVLET_H__
#define __SERVLET_SERVLET_H__

#include "../tools/head.h"

namespace xos_servlet
{
    class servlet : public xos_stl::mem_item< xos::release_impl<servlet>, thread_lock >,
        public http::i_servlet
    {
    public:
        typedef xos::release_impl<servlet> T;

    public:
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // 
        static int get_xos_item_data( ITEM_DATA*& item_ptr );

    public:
        servlet();
        ~servlet();

    public:
        http::i_servlet::enumRet proc( http::i_task * pTask );

    protected:
        int m_nStep;

    protected:
        int prepare_db( http::i_task * pTask );
        int execute_db( http::i_task * pTask );
        int helper_proc( http::i_task * pTask );
        int init_data();
        
    public:
        int init();
        int term();
        
    };

} // xos_servlet

#endif // __SERVLET_SERVLET_H__
